<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="UTF-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Welcome to 电子档案管理系统</title>
    <link rel="stylesheet" href="bootstrap-3.3.4/dist/css/bootstrap.min.css">
    <script src="js/jquery-1.11.3.js"></script>
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
        }

        body {

            background: url("images/4.jpg") fixed;
            background-repeat: no-repeat;
            background-size: cover;

            overflow: hidden;
            color: #fff;
            font-family: "微软雅黑";
        }

        .content {
            position: absolute;
            background: rgba(0, 0, 0, 0.7);
            width: 100%;
            height: 100%;
            top: 50px;
            padding: 0;

        }

        .navbar {
            background: rgba(0, 0, 0, 0.7);
            border: none;
            border-radius: 0;
        }

        .main-box {
            width: 343px;
            background: rgba(0, 0, 0, 0.1);
            border-radius: 5px;
            position: relative;
            margin: 30px 50%;
            left: -171px;
            box-sizing: border-box;
            overflow: hidden;

        }

        .register-box {
            display: none;
        }

        .main-box input {
            margin-bottom: 10px;
        }

        .main-box,
        .login-box,
        .register-box {
            padding: 0;
            margin-bottom: 10px;
            position: relative;
        }

        .main-box .login-box img,
        .main-box .register-box img {
            width: 220px;
            height: 220px;
            border-radius: 50%;
            border: 2px solid rgba(255, 255, 255, 0.3);
            box-shadow: 0px 2px 10px rgba(0, 0, 0, 0.5);
            margin: 0 auto;
            -webkit-transition: all 1s;
        }

        .clickRotate {
            -webkit-transform: rotateY(180deg);
        }

        .btn-box {
            width: 100%;
        }

        button {
            width: 50%;
        }

        .btn-box button {
            width: 50%;
            float: left;
            margin: 0;
            font-size: 20px;
            font-weight: 700;
            line-height: 45px;
            border: none;
            margin-bottom: 10px;
            background: none;
            -webkit-transition: all 1s;
        }

        .btn-box button:hover,
        .btn-box button:focus,
        .btn-box button:active,
        .btn-box button:visited {
            background: none;
            border: none;
            outline: none;
        }

        .hide_font_style {
            color: #FF0000;
            display: none;
        }


    </style>
    <script type="text/javascript">

        $(function () {
            $(".btn-box button span").hide();
            $(".login-btn").hover(function () {
                $(".login-btn span").show(100);
            }, function () {
                $(".login-btn span").hide(100);
            })
            $(".register-btn").hover(function () {
                $(".register-btn span").show(100);
            }, function () {
                $(".register-btn span").hide(100);
            })
            $(".login-btn").click(function () {
                $(".register-box").fadeOut(0);
                $(".login-box").fadeIn(500);
                $(".main-box .login-box img").toggleClass("clickRotate");

            })
            $(".register-btn").click(function () {
                $(".login-box").fadeOut(0);
                $(".register-box").fadeIn(500);
                $(".main-box .register-box img").toggleClass("clickRotate");
            })
        })
        /*   function formSubmit(name) {
         document.getElementById(name).submit();

         }*/
        function check_loginSubmit(form) {

            var temp = true;
            if (form.userName.value == '') {
                document.getElementById("account_info").style.display = "block";
                temp = false;
            } else {
                document.getElementById("account_info").style.display = "none";
            }
            if (form.pwd.value == '') {
                document.getElementById("pwd_info").style.display = "block";
                temp = false;
            } else {
                document.getElementById("pwd_info").style.display = "none";
            }
            return temp;
        }
        function check_registerSubmit(form) {

            var temp = true;

            if (form.userName.value == '') {
                document.getElementById("reg_account_info").style.display = "block";
                temp = false;
            } else {
                document.getElementById("reg_account_info").style.display = "none";
            }
            if (form.nickname.value == '') {
                document.getElementById("nickname_info").style.display = "block";
                temp = false;
            } else {
                document.getElementById("nickname_info").style.display = "none";
            }
            if (form.pwd.value == '') {
                document.getElementById("pwds_info").style.display = "block";
                temp = false;
            } else {
                document.getElementById("pwds_info").style.display = "none";
            }
            if (form.repwd.value == '' || (form.repwd.value != form.pwd.value)) {
                document.getElementById("repwd_info").style.display = "block";
                temp = false;
            } else {
                document.getElementById("repwd_info").style.display = "none";
            }

            if (form.e_mail.value == '') {
                document.getElementById("e_mail_info").style.display = "block";
                temp = false;
            } else {
                document.getElementById("e_mail_info").style.display = "none";
            }
            return temp;
        }
    </script>
</head>
<body>
<nav class="navbar" role="navigation">
    <div class="container-fluid">
        <div class="navbar-header">
            <a class="navbar-brand" href="#">电子档案管理系统</a>
        </div>
    </div>
</nav>
<div class="content">
    <div class="main-box col-md-6 ">
        <div class="btn-box col-md-12">
            <button class="btn btn-success login-btn"><span class="glyphicon glyphicon-ok">&nbsp;</span>登录</button>
            <button class="btn btn-primary register-btn"><span class="glyphicon glyphicon-pencil">&nbsp;</span>注册
            </button>
        </div>
        <div class="login-box col-md-12 text-center">
            <!--<div class="img-box">
                <img src="images/用户头像/user.jpg">
            </div>-->
            <div class="form-box col-md-12">
                <form class="form-group" action="login" method="post" Namespace="\" id="login"
                      onsubmit="return check_loginSubmit(this)">
                    <div>

                        <h4> <s:property value="message"/></h4>

                        <span><h4>账号</h4><input type="text" class="form-control" name="userName" id="account"
                                                maxlength="16"
                                                placeholder="请输入账号"
                                                onkeyup="this.value=this.value.replace(/^ +| +$/g,'')"></span>
                        <span class="hide_font_style" id="account_info"><h4>账号不能为空</h4></span>
                        <span><h4>密码</h4><input type="password" class="form-control" name="pwd" id="pwd"
                                                placeholder="请输入密码" maxlength="20"
                                                onkeyup="this.value=this.value.replace(/^ +| +$/g,'')"></span>
                        <span class="hide_font_style" id="pwd_info"><h4>密码不能为空</h4></span>
                        <input type="checkbox" class="pull-left"><span class="pull-left">记住密码</span>
                        <br>
                        <input
                                type="submit" name="sub" class="btn btn-primary" value="登陆"
                                style="width: 50%;margin-bottom: 10px;">
                    </div>
                </form>
            </div>
            <!--<button class="btn btn-primary" onclick="formSubmit('login')">登录</button>-->
        </div>

        <div class="register-box col-md-12 text-center">
            <div class="img-box">
            </div>
            <div class="form-box col-md-12">
                <form class="form-group" action="regist" method="post" Namespace="\"
                      onsubmit="return check_registerSubmit(this)">
                    <div>

                        <span><h4>账号</h4><input type="text" class="form-control" name="userName" maxlength="16"
                                                placeholder="请输入账号"
                                                onkeyup="this.value=this.value.replace(/^ +| +$/g,'')"></span>
                        <span class="hide_font_style" id="reg_account_info"><h4>账号不能为空</h4></span>

                        <span><h4>密码</h4><input type="password" name="pwd" class="form-control" maxlength="20"
                                                placeholder="请输入密码"
                                                onkeyup="this.value=this.value.replace(/^ +| +$/g,'')"></span>
                        <span class="hide_font_style" id="pwds_info"><h4>密码不能为空</h4></span>

                        <span><h4>确认密码</h4><input type="password" name="repwd" class="form-control" placeholder="请确认密码"
                                                  maxlength="20"
                                                  onkeyup="this.value=this.value.replace(/^ +| +$/g,'')"></span>
                        <span class="hide_font_style" id="repwd_info"><h4>俩次输入的密码不一致</h4></span>

                        <span><h4>昵称</h4><input type="text" class="form-control" name="nickname" placeholder="请输入昵称"
                                                maxlength="30"
                                                ></span>
                        <span class="hide_font_style" id="nickname_info"><h4>昵称不能为空</h4></span>

                        <span><h4>性别</h4></span>
                        <span><h4><input type="radio" name="gender" value="1" checked>男
                            <input type="radio" name="gender" value="0">女</h4></span>

                       <span><h4>邮箱</h4><input type="email" name="contact" class="form-control"
                                               onkeyup="this.value=this.value.replace(/^ +| +$/g,'')"></span>
                        <span class="hide_font_style" id="e_mail_info"><h4>邮箱不能为空</h4></span>

                        <input type="submit" name="sub" class="btn btn-success" style="width: 50%" value="注册并登录">
                        <!--<button class="btn btn-success" onclick="formSubmit('login')">注册并登录</button>-->
                    </div>
                </form>
            </div>

        </div>
    </div>

</div>
<script src="bootstrap-3.3.4\dist\js\bootstrap.min.js"></script>
</body>
</html>